﻿layui.use(['http', 'form', 'button', 'popup'], function () {
    var form = layui.form;
    var button = layui.button;
    var popup = layui.popup;
    var http = layui.http;
    // 登 录 提 交
    form.on('submit(login)', function (data) {
        var loading = button.load({
            elem: '.login',
        });
        data.field.remember = data.field.remember === "on";
        http.ajax({
            url: '/Login/Login',
            data: data.field,
            success: function (res) {
                loading.stop();
                if (res.code === 0) {
                    popup.success(res.msg, function () {
                        location.href = res.data
                    });
                } else {
                    popup.failure(res.msg);
                }
            }
        });
        return false;
    });
})